//
//  LBCCategoryCell.m
//  喜马拉雅改良版框架
//
//  Created by dllo on 15/12/23.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "LBCCategoryCell.h"

@interface LBCCategoryCell ()

@property (nonatomic, strong)UIImageView *iconImageV;
@property (nonatomic, strong)UILabel *nameLabel;

@end

@implementation LBCCategoryCell

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.iconImageV = [UIImageView new];
        [self.contentView addSubview:_iconImageV];
        [_iconImageV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(30);
            make.top.mas_equalTo(10);
            make.bottom.mas_equalTo(-10);
            make.width.equalTo(_iconImageV.mas_height);
            
        }];
        
        self.nameLabel = [UILabel new];
        _nameLabel.font = [UIFont systemFontOfSize:self.contentView.frame.size.height / 3];
        [self.contentView addSubview:_nameLabel];
        [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_iconImageV.mas_right).offset(10);
            make.top.equalTo(_iconImageV.mas_top);
            make.bottom.equalTo(_iconImageV.mas_bottom);
            make.width.mas_equalTo(100);
            
        }];
        
    }
    return self;
}

-(void)setCategory:(LBCCategory *)category{
    _category = category;
    [_iconImageV sd_setImageWithURL:[NSURL URLWithString:_category.coverPath] placeholderImage:[UIImage imageNamed:ImagePlaceHolder]];
    _nameLabel.text = _category.title;
}


@end
